package com.pentalog.ginet.domain;

	import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
	 
	@Entity
	@Table(name = "stockvn", uniqueConstraints = {
			@UniqueConstraint(columnNames = "STOCK_NAME"),
			@UniqueConstraint(columnNames = "STOCK_CODE") })
	public class Stockvn implements java.io.Serializable {
	 
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		private Integer stockId;
		private String stockCode;
		private String stockName;
		private StockDetail stockDetail;
	 
		public Stockvn() {
		}
	 
		public Stockvn(String stockCode, String stockName) {
			this.stockCode = stockCode;
			this.stockName = stockName;
		}
	 
		public Stockvn(String stockCode, String stockName, StockDetail stockDetail) {
			this.stockCode = stockCode;
			this.stockName = stockName;
			this.stockDetail = stockDetail;
		}
	 
		@Id
		@GeneratedValue(strategy = IDENTITY)
		@Column(name = "STOCK_ID", unique = true, nullable = false)
		public Integer getStockId() {
			return this.stockId;
		}
	 
		public void setStockId(Integer stockId) {
			this.stockId = stockId;
		}
	 
		@Column(name = "STOCK_CODE", unique = true, nullable = false, length = 2)
		public String getStockCode() {
			return this.stockCode;
		}
	 
		public void setStockCode(String stockCode) {
			this.stockCode = stockCode;
		}
	 
		@Column(name = "STOCK_NAME", unique = true, nullable = false, length = 20)
		public String getStockName() {
			return this.stockName;
		}
	 
		public void setStockName(String stockName) {
			this.stockName = stockName;
		}
	 
		@OneToOne(fetch = FetchType.LAZY, mappedBy = "stockvn", cascade = CascadeType.ALL)
		public StockDetail getStockDetail() {
			return this.stockDetail;
		}
	 
		public void setStockDetail(StockDetail stockDetail) {
			this.stockDetail = stockDetail;
		}
	 
}
